import 'package:flutter/material.dart';
import 'package:power_house/pages/home/info/data.dart';

import 'item_widget.dart';

class Info extends StatelessWidget {
  final bool isShowTitle;
  final List<InfoItem> dataList;

  const Info({Key? key, this.isShowTitle = false, this.dataList = infoData}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: <Widget>[
          if (isShowTitle)
            Container(
              padding: const EdgeInsets.all(10.0),
              alignment: Alignment.centerLeft,
              child: const Text(
                '最新资讯',
                style: TextStyle(color: Colors.black, fontWeight: FontWeight.w600),
              ),
            ),
          Column(
            children: dataList.map((item) => ItemWidget(item)).toList(),
          )
        ],
      ),
    );
  }
}
